package com.mechat.ui.webview

import android.os.Bundle
import com.custom.base.mvp.BasePresenterImpl

/**
 * 作者：
 * 时间：2021-01-22
 * 描述：网页
 */
class WebViewPresenter : BasePresenterImpl<WebViewContract.View>(), WebViewContract.Presenter {
    private var url = ""
    private var html = ""

    override fun initParms(parms: Bundle) {
        url = parms.getString("url","")
        html = parms.getString("html","")
    }

    override fun init() {
        initWebView()
    }

    private fun initWebView(){
        mView?.apply {
            if(html == "") webView.loadUrl(url)
            else webView.loadData(html,"text/html","UTF-8")

        }
    }

    override fun recycler() {
        mView?.apply {
            if(html == "") webView.loadUrl(url)
            else webView.loadData(html,"text/html","UTF-8")
        }
    }
}